// 饼状图
export function postponenum(data) {
    console.log("data------->", data);
    return {
        tooltip: {
            trigger: 'item'
        },
        // legend: {
        //   top: '5%',
        //   left: 'center'
        // },
        series: [
            {
                name: '填写率',
                type: 'pie',
                radius: ['30%', '60%'],
                avoidLabelOverlap: false,
                itemStyle: {
                    borderRadius: 10,
                    borderColor: '#fff',
                    borderWidth: 2
                },
                // label: {
                //   show: false,
                //   position: 'center'
                // },
                label: {
                    normal: {
                        show: true,
                        formatter: '{b}: {c}({d}%)' //自定义显示格式(b:name, c:value, d:百分比)
                    }
                },
                emphasis: {
                    label: {
                        show: true,
                        fontSize: '20',
                        fontWeight: 'bold'
                    }
                },
                labelLine: {
                    show: false
                },
                data: [
                    { value: data.num, name: '填写人数' },
                    { value: data.wtx_num, name: '未填写人数' }
                ]
            }
        ]
    }
}


// 柱状图
export function postponenumZ(data) {
    console.log("data------->", data);
    return {
        title: {
            text: '部门填写情况'
        },
        legend: {},
        tooltip: {},
        dataset: {
            dimensions: ['name', 'x_num', 'x_wt_num'],
            source: data
        },
        xAxis: { type: 'category' },
        yAxis: {},
        // Declare several bar series, each will be mapped
        // to a column of dataset.source by default.
        series: [{ type: 'bar', name: "已填写" }, { type: 'bar', name: "未填写" }]
    };
}

// 饼状图
export function postponenumBF(data) {
    console.log("data------->", data);
    return {
        dataset: {
            dimensions: ['fenlei_name', 'fenlei_count'],
            source: data
        },
        tooltip: {},
        // Declare several bar series, each will be mapped
        // to a column of dataset.source by default.
        series: [{
            type: 'pie', 
            name: "占比",
            label: {
                normal: {
                    show: true,
                    formatter: '{b}: ({d}%)' //自定义显示格式(b:name, c:value, d:百分比)
                }
            },
        }]
    };
}

// 柱状图
export function postponenumZF(data) {
    console.log("data------->", data);
    return {
        dataset: {
            dimensions: ['fenlei_name', 'fenlei_count'],
            source: data
        },
        xAxis: {},
        yAxis: { type: 'category' },
        // Declare several bar series, each will be mapped
        // to a column of dataset.source by default.
        series: [{ type: 'bar' }]
    };
}
